<template>
  <div class="messageBox">
    <div class="mask">
        <div class="con">
            <header>
                <span>
                   {{title}}
                   <slot name="distitle"></slot>
                </span>
                <b @click="$emit('close')">X</b>
            </header>
            <main>
                <p>内容</p>
                <slot name="discon"></slot>
            </main>
            <footer>
                <button>确定</button>
            </footer>
        </div>
    </div>
  </div>
</template>

<script>
export default {
  props: { // 接收父类组件的参数
    title: {
      type: String,
      required: true
    }
  }
}
</script>

<style lang="less" scoped>
.mask{
    width: 100%;
    height: 100%;
    background:rgba(0,0,0,.5);
    position: fixed;
    left: 0;
    top: 0;
    .con{
        width: 320px;
        height: 150px;
        background: #fff;
        border-radius: 10px;
        position: absolute;
        top: 30%;
        left: 50%;
        transform: translate(-50%,-50%);
        display: flex;
        flex-direction: column;
        header{
            display: flex;
            justify-content: space-between;
            height: 30px;
            align-items: center;
            padding: 0px 5px;
            background: #ddd;
        }
        main{
            flex:1;
            padding: 10px;
        }
        footer{
            height: 40px;
            width: 100%;
            text-align: right;
            padding-right: 20px;
            button{
                padding: 5px 10px;
                background: royalblue;
                color: #fff;
                border: none;
            }
        }
    }
}
</style>
